#nullable enable

using System;
using System.Collections.Generic;
using System.Threading.Tasks;

namespace PHMEE.EnergyEfficiency;

public interface IDigitalTDRepository
{
    /// <summary>
    /// 查询 digital 超级表下的每一张子表中的 utcNow 之前的最新一条数据
    /// </summary>
    /// <param name="vesselId"></param>
    /// <param name="dateTime"></param>
    /// <returns></returns>
    Task<List<Digital>> GetLatestRecordBeforeDateTimeFromSubtablesAsync(Guid vesselId, DateTime dateTime);

    /// <summary>
    /// 查询 digital 超级表下的每一张子表中的 utcNow 之前的最新一条数据，根据 ams_group 筛选
    /// </summary>
    /// <param name="vesselId"></param>
    /// <param name="dateTime"></param>
    /// <param name="amsGroup"></param>
    /// <returns></returns>
    Task<List<Digital>> GetLatestRecordBeforeDateTimeByAmsGroupFromSubtablesAsync(Guid vesselId,
        DateTime dateTime, string amsGroup);

    /// <summary>
    /// 查询 digital 超级表下的 startDateTime 和 endDateTime 之间的数据，不包含分组信息
    /// </summary>
    /// <param name="vesselId"></param>
    /// <param name="startDateTime"></param>
    /// <param name="endDateTime"></param>
    /// <returns></returns>
    [Obsolete]
    Task<List<Digital>> GetDigitalAlarmRecordsAsync(Guid vesselId, DateTime startDateTime, DateTime endDateTime);
    
    /// <summary>
    /// 根据 tagname 查询 digital 超级表下的 startDateTime 和 endDateTime 之间的数据，不包含分组信息
    /// </summary>
    /// <param name="vesselId"></param>
    /// <param name="tagName"></param>
    /// <param name="startDateTime"></param>
    /// <param name="endDateTime"></param>
    /// <returns></returns>
    [Obsolete]
    Task<List<Digital>> GetDigitalAlarmRecordsByTagnameAsync(Guid vesselId, string tagName,
        DateTime startDateTime, DateTime endDateTime);
        
    /// <summary>
    /// 获取所有 digital 的 tagdesc
    /// </summary>
    /// <param name="vesselId"></param>
    /// <returns></returns>
    Task<List<string>> GetAllDigitalTagdescAsync(Guid vesselId);
    
    /// <summary>
    /// 根据 tagdescriptions 查询 digital 超级表下的 startDateTime 和 endDateTime 之间的数据，不包含分组信息
    /// </summary>
    /// <param name="vesselId"></param>
    /// <param name="tagDescs"></param>
    /// <param name="startDateTime"></param>
    /// <param name="endDateTime"></param>
    /// <returns></returns>
    [Obsolete]
    Task<List<Digital>> GetDigitalAlarmRecordsByTagdescAsync(Guid vesselId, IEnumerable<string> tagDescs,
        DateTime startDateTime, DateTime endDateTime);

    /// <summary>
    /// 根据条件，查询 digital 超级表下的 startDateTime 和 endDateTime 之间的数据，不包含分组信息
    /// </summary>
    /// <param name="vesselId"></param>
    /// <param name="tagName"></param>
    /// <param name="tagDescs"></param>
    /// <param name="startDateTime"></param>
    /// <param name="endDateTime"></param>
    /// <param name="skipCount"></param>
    /// <param name="maxResultCount"></param>
    /// <returns></returns>
    Task<(int totalCount, List<Digital> digitals)> GetDigitalRecordsAsync(Guid vesselId, string? tagName, List<string>? tagDescs,
        DateTime startDateTime, DateTime endDateTime, int skipCount, int maxResultCount);

    /// <summary>
    /// 查询 digital 超级表下的指定 tagname 的子表中的每一张子表中的 utcNow 之前的最新一条数据
    /// </summary>
    /// <param name="vesselId"></param>
    /// <param name="dateTime"></param>
    /// <param name="tagNames"></param>
    /// <returns></returns>
    Task<List<Digital>> GetLatestRecordBeforeDateTimeByTagNamesAsync(Guid vesselId, DateTime dateTime,
        List<string> tagNames);
}